import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '机构名称',
    align:"center",
    dataIndex: 'titile_dictText'
   },
   {
    title: '发布人',
    align:"center",
    dataIndex: 'publisher'
   },
   {
    title: '发布时间',
    align:"center",
    dataIndex: 'publishTime',
	customRender:({text}) =>{
	  text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
	  return text;
	},
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
      label: "机构名称",
      field: 'titile',
     component: 'JDictSelectTag',
     componentProps:{
         dictCode:"web_institution_brief_type"
      },
      
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '机构名称',
    field: 'titile',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"web_institution_brief_type"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请选择机构名称!'},
          ];
     },
  },
  {
    label: '简介内容',
    field: 'content',
    component: 'JEditor',
  },
  {
    label: '发布人',
    field: 'publisher',
    component: 'Input',
  	dynamicRules: ({model,schema}) => {
  	      return [
  	             { required: true, message: '请输入发布人!'},
  	      ];
  	 },
  },
  {
    label: "发布时间",
    field: "publishTime",
    component: 'DatePicker',
    componentProps: {
  		showTime: true,
        valueFormat :'YYYY-MM-DD HH:mm:ss'
    },
  	dynamicRules: ({model,schema}) => {
  	      return [
  	             { required: true, message: '请输入发布时间!'},
  	      ];
  	 },
  },
  
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  titile: {title: '机构标题',order: 0,view: 'text', type: 'string',dictCode: 'web_institution_brief_type',},
  content: {title: '简介内容',order: 1,view: 'umeditor', type: 'string',},
  readNum: {title: '浏览量',order: 3,view: 'text', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
